'use strict';
var EntityClass = require('./Entity');

var _entityCollection = {};

exports.addEntity = function(entityName, name, parentEntity){
    var newEntity = new EntityClass(entityName, name, parentEntity);
    _entityCollection[entityName] = newEntity;
    // console.log(newEntity instanceof EntityClass);
    return newEntity;
};

exports.getEntity = function(entityName){
    var entity = _entityCollection[entityName];
    if(entity == undefined || entity == null){
        console.log("警告：获取实体 " + entityName + " 不存在，请检查程序");
        return null;
    }
    return entity;
};
